<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Clojure documentation browser</title><style>
.library
{
  padding: 0.5em 0 0 0 
}
.all-libs-toggle,.library-contents-toggle
{
 font-size: small;
}
.all-libs-toggle a,.library-contents-toggle a
{
 color: white
}
.library-member-doc-whitespace
{
 white-space: pre
}
.library-member-source-toggle
{
  font-size: small;
  margin-top: 0.5em
}
.library-member-source
{
  display: none;
  border-left: solid lightblue 
}
.library-member-docs
{
  font-family:monospace
}
.library-member-arglists
{
  font-family: monospace
}
.library-member-type
{
  font-weight: bold; 
  font-size: small;
  font-style: italic;
  color: darkred
}
.lib-links
{
  margin: 0 0 1em 0
}

.lib-link-header
{
  color: white;
  background: darkgreen;
  width: 100%
}

.library-name 
{ 
  color: white;
  background: darkblue;
  width: 100%
}

.missing-library
{
  color: darkred; 
  margin: 0 0 1em 0 
}

.library-members
{
  list-style: none
}

.library-member-name
{
  font-weight: bold;
  font-size: 105%
}</style><script language="JavaScript" type="text/javascript"> // <![CDATA[

function getElem(id)
{
  if( document.getElementById )
  {
    return document.getElementById( id )
  }
  else if ( document.all )
  {
    return eval( 'document.all.' + id )
  }
  else
    return false;
}

function setDisplayStyle(id,displayStyle)
{
  var elem = getElem (id)
  if (elem)
  {
    elem.style.display = displayStyle
  }

}

function setLinkToggleText (id, text)
{
 var elem = getElem (id)
 if (elem)
 {
   elem.innerHTML = text
 }
}

function collapse(id)
{
  setDisplayStyle (id, 'none')
}

function expand (id)
{
  setDisplayStyle (id, 'block')
}

function toggleSource( id )
{
  toggle(id, 'linkto-' + id, 'Hide Source', 'Show Source')
}

function toggle(targetid, linkid, textWhenOpen, textWhenClosed)
{
  var elem = getElem (targetid)
  var link = getElem (linkid)

  if (elem && link)
  {
    var isOpen = false
    if (elem.style.display == '')
    {
      isOpen = link.innerHTML == textWhenOpen
    }
    else if( elem.style.display == 'block' )
    {
      isOpen = true
    }
    
    if (isOpen)
    {
      elem.style.display = 'none'
      link.innerHTML = textWhenClosed
    }
    else
    {
      elem.style.display = 'block'
      link.innerHTML = textWhenOpen
    }
  }
}

      //]]>
</script><script language="JavaScript" type="text/javascript">// <![CDATA[!
function expandAllNamespaces()
{
expand(&apos;library-contents-Server.server&apos;);
setLinkToggleText(&apos;library-contents-toggle-Server.server&apos;, &apos;-&apos;);

}function collapseAllNamespaces()
{
collapse(&apos;library-contents-Server.server&apos;);
setLinkToggleText(&apos;library-contents-toggle-Server.server&apos;, &apos;+&apos;);

}
// ]]></script></head><body><div class="lib-links"><div class="lib-link-header">Namespaces<span class="all-libs-toggle"> [ <a href="javascript:expandAllNamespaces()">Expand All</a> ] [ <a href="javascript:collapseAllNamespaces()">Collapse All</a> ]</span></div><a class="lib-link" href="#library-Server.server">Server.server</a></div><div class="library"><a name="library-Server.server"/><div class="library-name"><span class="library-contents-toggle">[ <a id="library-contents-toggle-Server.server" href="javascript:toggle(&apos;library-contents-Server.server&apos;, &apos;library-contents-toggle-Server.server&apos;, &apos;-&apos;, &apos;+&apos;)">-</a> ] </span>Server.server</div><div class="library-contents" id="library-contents-Server.server"><div class="library-member-links"><a class="lib-member-link" href="#member-Server.server-*port*">*port*</a> <a class="lib-member-link" href="#member-Server.server--main">-main</a> <a class="lib-member-link" href="#member-Server.server-book-room-server">book-room-server</a> <a class="lib-member-link" href="#member-Server.server-create-register-server">create-register-server</a> <a class="lib-member-link" href="#member-Server.server-delete-register-server">delete-register-server</a> <a class="lib-member-link" href="#member-Server.server-edit-register-server">edit-register-server</a> <a class="lib-member-link" href="#member-Server.server-get-records-server">get-records-server</a> <a class="lib-member-link" href="#member-Server.server-init">init</a> <a class="lib-member-link" href="#member-Server.server-receive">receive</a> <a class="lib-member-link" href="#member-Server.server-return-index-server">return-index-server</a> <a class="lib-member-link" href="#member-Server.server-search-server">search-server</a> <a class="lib-member-link" href="#member-Server.server-test-connection-server">test-connection-server</a> <a class="lib-member-link" href="#member-Server.server-test-connection-server-2">test-connection-server-2</a></div><ol class="library-members"><li class="library-member"><a name="member-Server.server-*port*"/><dl class="library-member-table"><dt class="library-member-name">*port*</dt><dd><div class="library-member-info"><span class="library-member-type">var</span> <span class="library-member-arglists"></span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-*port*&apos;)" id="linkto-membersource-Server.server-*port*">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-*port*"><pre>(def *port* 8000)</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server--main"/><dl class="library-member-table"><dt class="library-member-name">-main</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([])</span></div><div class="library-member-docs"/><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server--main&apos;)" id="linkto-membersource-Server.server--main">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server--main"><pre>(defn -main
  []
(init *port*))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-book-room-server"/><dl class="library-member-table"><dt class="library-member-name">book-room-server</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([input output index new-owner])</span></div><div class="library-member-docs"><div class="library-member-doc-line">calls the method book</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-book-room-server&apos;)" id="linkto-membersource-Server.server-book-room-server">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-book-room-server"><pre>(defn book-room-server
  &quot;calls the method book&quot;
  [input output index new-owner]
  (book-room-rbf (Integer. index) new-owner)
  (.println output &quot;ok&quot;)
  (.flush output)
    )</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-create-register-server"/><dl class="library-member-table"><dt class="library-member-name">create-register-server</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([input output nam location size smoking rate date owner])</span></div><div class="library-member-docs"><div class="library-member-doc-line">create a new register in the database</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-create-register-server&apos;)" id="linkto-membersource-Server.server-create-register-server">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-create-register-server"><pre>(defn create-register-server
  &quot;create a new register in the database&quot;
  [input output nam location size smoking rate date owner]
  (create-register-rbf nam location size smoking rate date owner)
  (.println output &quot;ok&quot;)
  (.flush output)
    )</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-delete-register-server"/><dl class="library-member-table"><dt class="library-member-name">delete-register-server</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([input output index])</span></div><div class="library-member-docs"><div class="library-member-doc-line">calls the method delete, this delete a register in the database</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-delete-register-server&apos;)" id="linkto-membersource-Server.server-delete-register-server">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-delete-register-server"><pre>(defn delete-register-server
  &quot;calls the method delete, this delete a register in the database&quot;
  [input output index]
  (delete-register-rbf (Integer. index))
  (.println output &quot;ok&quot;)
  (.flush output)
    )</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-edit-register-server"/><dl class="library-member-table"><dt class="library-member-name">edit-register-server</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([input output index nam location size smoking rate date owner])</span></div><div class="library-member-docs"><div class="library-member-doc-line">edit a register in the database, calls the edit-register</div><div class="library-member-doc-line">  in the readbinfile</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-edit-register-server&apos;)" id="linkto-membersource-Server.server-edit-register-server">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-edit-register-server"><pre>(defn edit-register-server
  &quot;edit a register in the database, calls the edit-register...&quot;
  [input output index nam location size smoking rate date owner]
  (edit-register-rbf (Integer. index) nam location size smoking rate date owner)
  (.println output &quot;ok&quot;)
  (.flush output)
    )</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-get-records-server"/><dl class="library-member-table"><dt class="library-member-name">get-records-server</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([input output])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Get records from server</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-get-records-server&apos;)" id="linkto-membersource-Server.server-get-records-server">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-get-records-server"><pre>(defn get-records-server
  &quot;Get records from server&quot;
  [input output]   
    ;(.println output &quot;waka-waka&quot;)
    ;(.println output (get-records))
    (.println output (auxiliar))
    (.flush output))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-init"/><dl class="library-member-table"><dt class="library-member-name">init</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([port])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Init the server</div><div class="library-member-doc-line">  Listen the port 8000</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-init&apos;)" id="linkto-membersource-Server.server-init">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-init"><pre>(defn init
  &quot;Init the server...&quot;
  [port]
  (let [
    server (ServerSocket. port)
	  agent  (agent nil)
	  ]
    (loop []
      (println &quot;Waiting for connections&quot;)
      (let [socket (.accept server)]
        (send-off agent receive socket))
    (recur))))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-receive"/><dl class="library-member-table"><dt class="library-member-name">receive</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([_ socket])</span></div><div class="library-member-docs"><div class="library-member-doc-line">Check for the command send and call a function to interect with the </div><div class="library-member-doc-line">  readbinfile and the database</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-receive&apos;)" id="linkto-membersource-Server.server-receive">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-receive"><pre>(defn receive
  &quot;Check for the command send and call a function to interect with the ...&quot;
  [_ socket]
  (with-open [input (BufferedReader. (InputStreamReader. (.getInputStream socket)))
	            output (PrintWriter. (.getOutputStream socket))]
    (let [
          command-and-args (.readLine input)
          arreglo (.split (print-str command-and-args) &quot;_&quot;)
          longitud (count arreglo)
          cmd (nth arreglo 0)
       ]
       (.flush output)         
         (print command-and-args)
         (if (.equals cmd &quot;hola&quot;)
           (test-connection-server input output (nth arreglo 1))
           )
         (if (.equals cmd &quot;waka&quot;)
           (test-connection-server-2 input output)
           )
         (if (.equals cmd &quot;get-records&quot;)
           (get-records-server input output)
           )
         (if (.equals cmd &quot;return-index&quot;)
           (return-index-server input output
             (nth arreglo 1)
             (nth arreglo 2)
             (nth arreglo 3)
             (nth arreglo 4)
             (nth arreglo 5)
             (nth arreglo 6)
             (if (= 7 longitud)
               &quot;&quot;
               (nth arreglo 7))
             )
           )
         (if (.equals cmd &quot;edit-register-rbf&quot;)
           (edit-register-server input output
             (nth arreglo 1)
             (nth arreglo 2)
             (nth arreglo 3)
             (nth arreglo 4)
             (nth arreglo 5)
             (nth arreglo 6)
             (nth arreglo 7)
             (if (= 8 longitud)
               &quot;&quot;
               (nth arreglo 8))
               )
             )
         (if (.equals cmd &quot;book-room-rbf&quot;)
           (book-room-server input output
             (nth arreglo 1)
             (if (= 2 longitud)
               &quot;&quot;
               (nth arreglo 2))
               )
             )
         (if (.equals cmd &quot;delete-register-rbf&quot;)
           (delete-register-server input output
             (nth arreglo 1)
               )
             )
         (if (.equals cmd &quot;create-register-rbf&quot;)
           (create-register-server input output
             (nth arreglo 1)
             (nth arreglo 2)
             (nth arreglo 3)
             (nth arreglo 4)
             (nth arreglo 5)
             (nth arreglo 6)
             (if (= 7 longitud)
               &quot;&quot;
               (nth arreglo 7))
             )
           )
         (if (.equals cmd &quot;search&quot;)
           (search-server input output
            (if (= 2 longitud)
               &quot;&quot;
               (nth arreglo 1))
             (nth arreglo 2))
           )
           )
	     ))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-return-index-server"/><dl class="library-member-table"><dt class="library-member-name">return-index-server</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([input output nam location size smoking rate date owner])</span></div><div class="library-member-docs"><div class="library-member-doc-line">auxiliar method, return a list with the index of the register send</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-return-index-server&apos;)" id="linkto-membersource-Server.server-return-index-server">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-return-index-server"><pre>(defn return-index-server
  &quot;auxiliar method, return a list with the index of the register send&quot;
  [input output nam location size smoking rate date owner]
  (.println output (return-index-aux nam location size smoking rate date owner))
  (.flush output)
    )</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-search-server"/><dl class="library-member-table"><dt class="library-member-name">search-server</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([input output text field])</span></div><div class="library-member-docs"><div class="library-member-doc-line">search by keyword</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-search-server&apos;)" id="linkto-membersource-Server.server-search-server">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-search-server"><pre>(defn search-server
  &quot;search by keyword&quot;
  [input output text field]
   (if (.equals field &quot;:name&quot;) (.println output (search-aux text :name)))
   (if (.equals field &quot;:location&quot;)  (.println output (search-aux text :location)))
   (if (.equals field &quot;:size&quot;) (.println output (search-aux text :size)))
   (if (.equals field &quot;:smoking&quot;) (.println output (search-aux text :smoking)))
   (if (.equals field &quot;:rate&quot;) (.println output (search-aux text :rate)))
   (if (.equals field &quot;:date&quot;) (.println output (search-aux text :date)))
   (if (.equals field &quot;:owner&quot;) (.println output (search-aux text :owner)))
  (.flush output))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-test-connection-server"/><dl class="library-member-table"><dt class="library-member-name">test-connection-server</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([input output args])</span></div><div class="library-member-docs"><div class="library-member-doc-line">prueba</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-test-connection-server&apos;)" id="linkto-membersource-Server.server-test-connection-server">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-test-connection-server"><pre>(defn test-connection-server
  &quot;prueba&quot;
  [input output args]
    ;(print args)
    ;(print &quot;jojo&quot;)
    ;(.println output &quot;wiiiiii&quot;)
    (.println output args)
    (.flush output))</pre></div></div></dd></dl></li><li class="library-member"><a name="member-Server.server-test-connection-server-2"/><dl class="library-member-table"><dt class="library-member-name">test-connection-server-2</dt><dd><div class="library-member-info"><span class="library-member-type">fn</span> <span class="library-member-arglists">([input output])</span></div><div class="library-member-docs"><div class="library-member-doc-line">prueba</div></div><div class="library-member-source-section"><div class="library-member-source-toggle">[ <a href="javascript:toggleSource(&apos;membersource-Server.server-test-connection-server-2&apos;)" id="linkto-membersource-Server.server-test-connection-server-2">Show Source</a> ]</div><div class="library-member-source" id="membersource-Server.server-test-connection-server-2"><pre>(defn test-connection-server-2
  &quot;prueba&quot;
  [input output]   
    (.println output &quot;waka-waka&quot;)
    (.flush output))</pre></div></div></dd></dl></li></ol></div></div></body></html>